<%@ page import="cn.tedu.web.stm.JdbcUtils" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.tedu.web.stm.homework.Goods" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
    String sql="SELECT * FROM `goods`";
    List<Goods> goods = JdbcUtils.selects(sql, Goods.class);
%>

<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java实训团队协作简单案例 - 商品列表页面</title>
    <link rel="shortcut icon" href="assets/img/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="assets/vendors/font-awesome-4.7.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="assets/css/core.css" />
    <link rel="stylesheet" href="assets/css/index.css" />
    <link rel="stylesheet" href="assets/css/goods.css" />
</head>

<body>
    <jsp:include page="/WEB-INF/tpl/stm/header.jsp"/>
    <section class="container">
        <jsp:include page="/WEB-INF/tpl/stm/side.jsp"/>
        <div class="main-right">
            <h3>商品列表页面</h3>
            <a href="goods-edit.jsp"><h4><i class="fa fa-plus"></i> 新增商品</h4></a>
            <div class="goods-container">
                <% for (Goods u : goods) {%>
                <div class="goods-item">
                    <img class="goods-img" src="assets/img/<%=u.getImage()%>" />
                    <h4><span class="goods-price">价格：￥<%=u.getPrice()%></span></h4>
                    <h4><span class="goods-title">商品名：<%=u.getName()%></span></h4>
                    <span class="goods-footer">
                        <a href="goods-edit.jsp"><i class="fa fa-pencil"></i></a>
                        <a href="/stmgoods/deleted?id=<%=u.getId()%>"><i class="fa fa-trash"></i></a>
                    </span>
                </div>
                <%  }%>
            </div>
            <div class="goods-pager">
                <h4><span>总共 <b><%=goods.size()%></b> 条数据，当前是第 <b>1</b> 页。</span></h4>
                <button type="button" style="margin: 20px">上一页</button>
                <button type="button" style="margin: 20px 100px">下一页</button>
            </div>
        </div>
    </section>
</body>

</html>